
def createFileName(fileName):
    fileNameArray = fileName.split('_')
    resultFileName = str()
    for fileName in fileNameArray:
        if fileName =='DSFID' or fileName =='AFI' or fileName == "ID":
            resultFileName += fileName
            continue
        
        resultFileName += fileName[0].upper()
        resultFileName += fileName[1:].lower()
    return resultFileName
    
def createFile(fileName, ExceptionID):
    
    fileObject = open(fileName+"Exception.py", "w")
    
    importContent = "from CompletionCodeException import CompletionCodeException\n\n"
    className = "class "+fileName+"Exception(CompletionCodeException):\n"
    initDef = "    def __init__(self):\n"
    initDefContent = "        CompletionCodeException.__init__(self, "+str(ExceptionID)+")\n"
    
    fileObject.write(importContent)
    fileObject.write(className)
    fileObject.write(initDef)
    fileObject.write(initDefContent)
    
if __name__ =='__main__':
    createFile(createFileName('NO_ERROR'), 0)
    createFile(createFileName('AFI_NOT_CONFIGURED'), 1)
    createFile(createFileName('AFI_NOT_CONFIGURED_LOCKED'), 2)
    createFile(createFileName('AFI_CONFIGURED_LOCK_FAILED'), 3)
    createFile(createFileName('DSFID_NOT_CONFIGURED'), 4)
    createFile(createFileName('DSFID_NOT_CONFIGURED_LOCKED'), 5)
    createFile(createFileName('DSFID_CONFIGURED_LOCK_FAILED'), 6)
    createFile(createFileName('OBJECT_LOCKED_COULD_NOT_MODIFY'), 7)
    createFile(createFileName('TAG_ID_NOT_FOUND'), 8)
    createFile(createFileName('OBJECT_NOT_ADDED'), 9)
    createFile(createFileName('DUPLICATE_OBJECT'), 10)
    createFile(createFileName('OBJECT_ADDED_BUT_NOT_LOCKED'), 11)
    createFile(createFileName('OBJECT_NOT_DELETEd'), 12)
    createFile(createFileName('OBJECT_IDENTIFIER_NOT_FOUND'), 13)
    createFile(createFileName('OBJECT_LOCKED_COULD_NOT_DELETE'), 14)
    createFile(createFileName('OBJECT_NOT_READ'), 15)
    createFile(createFileName('RESERVED'), 16)
    createFile(createFileName('BLOCKS_LOCKED'), 17)
    createFile(createFileName('ERASE_INCOMPLETE'), 18)
    createFile(createFileName('READ_INCOMPLETE'), 19)
    createFile(createFileName('SYSTEM_INFO_NOT_READ'), 20)
    createFile(createFileName('OBJECT_NOT_MODIFIED'), 21)
    createFile(createFileName('OBJECT_MODIFIED_BUT_NOT_LOCKED'), 22)
    createFile(createFileName('FAILED_TO_READ_MINIMUM_NUMBER_OF_TAGS'), 23)
    createFile(createFileName('FAILED_TO_READ_EXACT_NUMBER_OF_TAGS'), 24)
    createFile(createFileName('PASSWORD_MISMATCH'), 25)
    createFile(createFileName('PASSWORD_NOT_WRITTEN'), 26)
    createFile(createFileName('AFI_MISMATCH'), 26)
    createFile(createFileName('DSFID_MISMATCH'), 27)
    createFile(createFileName('ZERO_KILL_PASSWORD_ERROR'), 27)
    createFile(createFileName('KILL_FAILED'), 28)
    createFile(createFileName('ISO_IEC_24791_5_RESULT_CODE'), 253)
    createFile(createFileName('UNDEFINED_COMMAND_ERROR'), 254)
    createFile(createFileName('EXECUTION_ERROR'), 255)